package com.fyt.reachgo.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

import jakarta.persistence.*;
import lombok.Data;

/**
 * 用户行程规划请求记录表
 * @TableName travel_request
 */
@TableName(value ="travel_request")
@Data
@Entity
@Table(name = "travel_request")
public class TravelRequest implements Serializable {
    /**
     * 请求唯一标识
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY) // 确保使用自增策略
    @TableId(type = IdType.AUTO)
    private String id;

    /**
     * 关联用户ID
     */
    @Column(name = "user_id", nullable = false)
    private Long userId;

    /**
     * 出发地点
     */
    @Column(nullable = false, length = 100)
    private String departure;

    /**
     * 目的地
     */
    @Column(nullable = false, length = 100)
    private String destination;

    /**
     * 行程天数
     */
    @Column(nullable = false)
    private Integer days;

    /**
     * 住宿夜数
     */
    @Column(nullable = false)
    private Integer nights;

    /**
     * 出行人数
     */
    @Column(name = "people_count", nullable = false)
    private Integer peopleCount;

    /**
     * 首选交通工具
     */
    @Column(length = 50)
    private String transportation;

    /**
     * 处理状态：processing处理中/completed已完成
     */
    @Column(nullable = false)
    private Object status;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TravelRequest other = (TravelRequest) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getDeparture() == null ? other.getDeparture() == null : this.getDeparture().equals(other.getDeparture()))
            && (this.getDestination() == null ? other.getDestination() == null : this.getDestination().equals(other.getDestination()))
            && (this.getDays() == null ? other.getDays() == null : this.getDays().equals(other.getDays()))
            && (this.getNights() == null ? other.getNights() == null : this.getNights().equals(other.getNights()))
            && (this.getPeopleCount() == null ? other.getPeopleCount() == null : this.getPeopleCount().equals(other.getPeopleCount()))
            && (this.getTransportation() == null ? other.getTransportation() == null : this.getTransportation().equals(other.getTransportation()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getDeparture() == null) ? 0 : getDeparture().hashCode());
        result = prime * result + ((getDestination() == null) ? 0 : getDestination().hashCode());
        result = prime * result + ((getDays() == null) ? 0 : getDays().hashCode());
        result = prime * result + ((getNights() == null) ? 0 : getNights().hashCode());
        result = prime * result + ((getPeopleCount() == null) ? 0 : getPeopleCount().hashCode());
        result = prime * result + ((getTransportation() == null) ? 0 : getTransportation().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userId=").append(userId);
        sb.append(", departure=").append(departure);
        sb.append(", destination=").append(destination);
        sb.append(", days=").append(days);
        sb.append(", nights=").append(nights);
        sb.append(", peopleCount=").append(peopleCount);
        sb.append(", transportation=").append(transportation);
        sb.append(", status=").append(status);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}